package com.bytedance.social.common;

import com.bytedance.user.common.ExceptionReturn;
import com.bytedance.user.common.StatusCode;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice
public class GlobalExceptionHandler {
    /**
     * 全局异常处理
     * 返回前端
     */
    @ExceptionHandler(Exception.class)
    @ResponseBody
    public com.bytedance.user.common.ExceptionReturn exceptionReturn(Exception exception) {
        com.bytedance.user.common.ExceptionReturn exceptionReturn = new ExceptionReturn();
        exceptionReturn.setStatus_msg("当前社交服务系统繁忙！");
        exceptionReturn.setStatus_code(StatusCode.STATUS_FAIL);
        return exceptionReturn;
    }

}
